package com.epfresh.supplier.entity;

import android.util.Pair;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wangzhanghuan
 * @version 1.0
 * @date create 18-1-5
 * @Description
 */

public class OrderTrackResponse {


   /* {
        "disContacter": "不过现在",
            "disNumber": "6401201801040060",
            "grouponNo": "030024",
            "nodes": [
        {
            "time": "2018-01-04 15:03",
                "word": [
            "你鱼鱼鱼鱼鱼鱼发起减免退款，少货您驳回减免退款0.04元",
                    "共收金额：0.12元",
                    "没有什么不可以说得出来你也不知道怎么样呢…………………………不了不说话你是什么地方都可以用我手机给你发短信说我没有什么"
        ],
            "affImgUrls": [
            "http://imgtest.epfresh.com/ba2aabf8ce13fb8491f56a3129561f06.png",
                    "http://imgtest.epfresh.com/528593ca34c8b348defd5bb7e7cfa149.png",
                    "http://imgtest.epfresh.com/d3420b4fe9e682740073b53bb715a2b3.png"
        ]
        },
        {
            "time": "2018-01-04 10:34",
                "word": [
            "你鱼鱼鱼鱼鱼鱼发起减免退款，少货需减免退款0.04元",
                    "共收金额：0.12元",
                    "没有什么不可以说得出来你也不知道怎么样呢…………………………不了不说话你是什么地方都可以用我手机给你发短信说我没有什么"
        ],
            "affImgUrls": [
            "http://imgtest.epfresh.com/ba2aabf8ce13fb8491f56a3129561f06.png",
                    "http://imgtest.epfresh.com/528593ca34c8b348defd5bb7e7cfa149.png",
                    "http://imgtest.epfresh.com/d3420b4fe9e682740073b53bb715a2b3.png"
        ]
        },
        {
            "time": "2018-01-04 10:30",
                "word": [
            "你鱼鱼鱼鱼鱼鱼发起减免退款，少货需减免退款0.04元",
                    "共收金额：0.12元",
                    "没有什么不可以说得出来你也不知道怎么样呢…………………………不了不说话你是什么地方都可以用我手机给你发短信说我没有什么"
        ]
        },
        {
            "time": "2018-01-04 10:22",
                "word": [
            "你鱼鱼鱼鱼鱼鱼发起减免退款，少货需减免退款0.04元",
                    "共收金额：0.12元",
                    "没有什么不可以说得出来你也不知道怎么样呢…………………………不了不说话你是什么地方都可以用我手机给你发短信说我没有什么"
        ]
        },
        {
            "time": "2018-01-04 10:14",
                "word": [
            "你鱼鱼鱼鱼鱼鱼发起减免退款，货物损坏您驳回减免退款0.03元",
                    "共收金额：0.12元",
                    "是啊……好好用一颗爱国力量雄厚？不要让人失望过、不要紧吗"
        ]
        },
        {
            "time": "2018-01-04 10:13",
                "word": [
            "你鱼鱼鱼鱼鱼鱼发起减免退款，货物损坏您驳回减免退款0.03元",
                    "共收金额：0.12元",
                    "是啊……好好用一颗爱国力量雄厚？不要让人失望过、不要紧吗"
        ]
        },
        {
            "time": "2018-01-04 10:10",
                "word": [
            "你鱼鱼鱼鱼鱼鱼发起减免退款，货物损坏需减免退款0.03元",
                    "共收金额：0.12元",
                    "是啊……好好用一颗爱国力量雄厚？不要让人失望过、不要紧吗"
        ]
        },
        {
            "time": "2018-01-04 10:08",
                "word": [
            "配送中",
                    "共收金额：0.12元"
        ]
        },
        {
            "time": "2018-01-04 10:05",
                "word": [
            "已收货",
                    "共收金额：0.12元"
        ]
        },
        {
            "time": "2018-01-03 10:47",
                "word": [
            "待发货",
                    "共收金额：0.12元"
        ]
        },
        {
            "time": "2018-01-03 09:46",
                "word": [
            "拼货中",
                    "已付金额：0.09元"
        ]
        },
        {
            "time": "2018-01-03 09:46",
                "word": [
            "拼货中",
                    "已付金额：0.03元"
        ]
        }
    ],
        "deliveryWay": "没有了！是否",
            "carrier": "天通银",
            "disContactPhone": "3555666666777",
            "estimateArriveTime": "2018-01-04",
            "vehicleNo": "888888"
    }
*/

    /*{
         "grouponNo": "拼货编号",
             "disNumber": "配送单号",
             "carrier": "承运方",
             "estimateArriveTime": "预计到货日期",
             "disContacter": "送货人",
             "disContactPhone": "联系电话",
             "deliveryWay": "配送方式",
             "vehicleNo": "车牌号",
             "nodes": \[
         {
             "word": "文案",
                 "affImgUrls": "附件",
                 "time": "时间"
         },
         {
             "word": "文案",
                 "affImgUrls": "附件",
                 "time": "时间"
         }\
     ]
     }*/
    String grouponNo;
    String disNumber;
    String carrier;
    String estimateArriveTime;
    String disContacter;
    String disContactPhone;
    String deliveryWay;
    String vehicleNo;
    List<OrderTrackWord> nodes;

    public String getGrouponNo() {
        return grouponNo;
    }

    public void setGrouponNo(String grouponNo) {
        this.grouponNo = grouponNo;
    }

    public String getDisNumber() {
        return disNumber;
    }

    public void setDisNumber(String disNumber) {
        this.disNumber = disNumber;
    }

    public String getCarrier() {
        return carrier;
    }

    public void setCarrier(String carrier) {
        this.carrier = carrier;
    }

    public String getEstimateArriveTime() {
        return estimateArriveTime;
    }

    public void setEstimateArriveTime(String estimateArriveTime) {
        this.estimateArriveTime = estimateArriveTime;
    }

    public String getDisContacter() {
        return disContacter;
    }

    public void setDisContacter(String disContacter) {
        this.disContacter = disContacter;
    }

    public String getDisContactPhone() {
        return disContactPhone;
    }

    public void setDisContactPhone(String disContactPhone) {
        this.disContactPhone = disContactPhone;
    }

    public String getDeliveryWay() {
        return deliveryWay;
    }

    public void setDeliveryWay(String deliveryWay) {
        this.deliveryWay = deliveryWay;
    }

    public String getVehicleNo() {
        return vehicleNo;
    }

    public void setVehicleNo(String vehicleNo) {
        this.vehicleNo = vehicleNo;
    }

    public List<OrderTrackWord> getNodes() {
        return nodes;
    }

    public void setNodes(List<OrderTrackWord> nodes) {
        this.nodes = nodes;
    }

    /*{
         "grouponNo": "拼货编号",
             "disNumber": "配送单号",
             "carrier": "承运方",
             "estimateArriveTime": "预计到货日期",
             "disContacter": "送货人",
             "disContactPhone": "联系电话",
             "deliveryWay": "配送方式",
             "vehicleNo": "车牌号",
             "nodes": \[
         {
             "word": "文案",
                 "affImgUrls": "附件",
                 "time": "时间"
         },
         {
             "word": "文案",
                 "affImgUrls": "附件",
                 "time": "时间"
         }\
     ]
     }*/
    public List<Pair<String, String>> getBaseInfo() {
        List<Pair<String, String>> list = new ArrayList<>();
        updateBaseInfo("拼货单号", grouponNo, list);
        updateBaseInfo("配送单号", disNumber, list);
        updateBaseInfo("承运方", carrier, list);
        updateBaseInfo("预计到货日期", estimateArriveTime, list);
        updateBaseInfo("送货人", disContacter, list);
        updateBaseInfo("联系电话", disContactPhone, list);
        updateBaseInfo("配送方式", deliveryWay, list);
        updateBaseInfo("车牌", vehicleNo, list);

        return list;

    }

    private void updateBaseInfo(String key, String value, List<Pair<String, String>> list) {
        if (value != null && !"".equals(value)) {
            list.add(new Pair<>(key, value));
        }

    }

    public List<OrderTrackWord> getOrderTrackList() {
        List<OrderTrackWord> otws = new ArrayList<>();

        if (nodes != null && nodes.size() > 0) {
            int size = nodes.size();
            for (int i = 0; i < size; i++) {
                OrderTrackWord otw = nodes.get(i);

                if (otw != null) {
                    if (i == 0) {
                        otw.setTopLine(false);
                        otw.setTop(true);
                    } else {
                        otw.setTopLine(true);
                        otw.setTop(false);
                    }

                    if (i == size - 1) {
                        otw.setBottomLine(false);
                    } else {
                        otw.setBottomLine(true);
                    }

                    if (i == 1) {
                        otw.setBoldTop(true);
                    } else {
                        otw.setBoldTop(false);

                    }

                    otws.add(otw);
                }
            }
        }

        return otws;
    }
}
